/**
 * 功能描述
 */

define(function (require, exports, module) {
	var total = require("./total");
	
    module.exports = {
    	billing:function(data,widget){
    		widget.hide([".J-grid"]).show([".J-form",".J-editgrid",".J-total"]);
    		widget.get("subnav").show(["save","return"]).hide(["servicePoint","destination","travelDate"]);
    		
    		data.finish = {
    				key:data.finish,
    				value:data.finish=="false"?"否":"是"
    		};
    		var datas = [];
    		datas = $.extend(true, [], data);
    		datas.allianceSettlement.settlementDate=moment().format("YYYY-MM-DD"),
    		widget.get("form").setData(datas);
    		widget.get("editgrid").refresh(null,function(datas){
    			total.total(widget,data);
    		});
    		
    	},
    	confirm:function(data,widget){
    		widget.hide([".J-grid"]).show([".J-form",".J-editgrid",".J-total"]);
    		widget.get("subnav").show(["return"]).hide(["servicePoint","destination","travelDate"]);
    		widget.get("form").setData(data);
    		widget.get("editgrid").refresh(null,function(datas){
    			total.total(widget,data);
    			widget.get("totalGrid").setDisabled(true);
    			widget.get("editgrid").setDisabled(true);
    		});
    	}
    };
});
